package edu.del.newsreleasesystem;

import edu.del.newsreleasesystem.es.service.NewsEsIndexService;
import lombok.RequiredArgsConstructor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;

@SpringBootApplication
@MapperScan("edu.del.newsreleasesystem.mapper")
@EnableAsync
@RequiredArgsConstructor
public class NewsReleaseSystemApplication implements CommandLineRunner {

    private final NewsEsIndexService newsEsIndexService;


    public static void main(String[] args) {
        SpringApplication.run(NewsReleaseSystemApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        newsEsIndexService.initializeNewsIndexAsync();
    }
}
